package cn.xopencode.securityservice.provider.violate;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.securityservice.rpc.suggest.SuggestRpc;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestCreateReqDTO;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestPageReqDTO;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestRespDTO;
import cn.xopencode.securityservice.rpc.violate.ViolateRpc;
import cn.xopencode.securityservice.rpc.violate.dto.ViolateAuditReqDTO;
import cn.xopencode.securityservice.rpc.violate.dto.ViolateCreateReqDTO;
import cn.xopencode.securityservice.rpc.violate.dto.ViolatePageReqDTO;
import cn.xopencode.securityservice.rpc.violate.dto.ViolateRespDTO;
import cn.xopencode.securityservice.service.suggest.SuggestService;
import cn.xopencode.securityservice.service.violate.ViolateService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import static cn.xopencode.common.framework.vo.CommonResult.success;

/**
 * 反三违及事故情况 Rpc 实现
 */
@DubboService(version = "${dubbo.provider.ViolateRpc.version}")
public class ViolateRpcProviderImpl implements ViolateRpc {
    @Autowired
    private ViolateService violateService;

    @Override
    public CommonResult<ViolateRespDTO> getViolate(String violateId) {
        return success(violateService.getViolate(violateId));
    }

    @Override
    public CommonResult<Integer> createViolate(ViolateCreateReqDTO createDTO) {
        return success(violateService.createViolate(createDTO));
    }

    @Override
    public CommonResult<PageResult<ViolateRespDTO>> pageViolate(ViolatePageReqDTO pageDTO) {
        return success(violateService.pageViolate(pageDTO));
    }

    @Override
    public CommonResult<Integer> auditViolate(ViolateAuditReqDTO reqDTO) {
        return success(violateService.auditViolate(reqDTO));
    }
}
